import pytest,requests
class Test_A3mall:
    token=None
    def setUP_method(self):
        print("执行前...")
    def teardown_method(self):
        print("执行后...")
    # 登录
    def test_login(self):
        url="http://10.59.9.12:7001/api/public/login"
        data={"username":"13811033962","password":"123456"}
        res=requests.post(url=url,json=data)
        print("登录接口",res.json())
        Test_A3mall.token="Bearer "+res.json()["data"]["token"]
        assert "银牌会员" in res.text
    # 确认订单
    def test_queren(self):
        url="http://10.59.9.12:7001/api/order/create"
        data={"id":"6","type":"second","address_id":5,"store_id":1,
              "shipping_type":1,"bonus_id":"0",
              "payment":"balance","remarks":"","source":1,
              "url":"http://10.59.9.12:7001/wap/pages/cart/confirm?id=6&sku_id=&num=1&type=second",
              "sku_id":"","num":"1"}
        header={"content-type":"application/json","auth-token":Test_A3mall.token}
        res=requests.post(url=url,json=data,headers=header)
        print("确认订单接口",res.json())
        assert "支付成功" in res.text